package com.cyf.db.mapper.smartCity;

import com.cyf.db.bean.LocalRechargeRecord;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author hfy
 * @date 2018/11/28
 */
public interface LocalRechargeRecordMapper {

    @Select("<script>" +
            "select * " +
            "from local_rechargerecord " +
            "<where>" +
            "   <if test=\" parkingId != 0 \">" +
            "      and parkingId = #{parkingId}" +
            "   </if>" +
            "   <if test=\" plate != null and plate != '' \">" +
            "      and plate = #{plate} " +
            "   </if>" +
            "   <if test=\" createdTime != null and createdTime != '' \">" +
            "      <![CDATA[ and createdTime >= '${createdTime} 00:00:00' and createdTime <= '${createdTime} 23:59:59']]> " +
            "   </if>" +
            "</where>" +
            "order by createdTime desc " +
            "limit #{start}, #{pageSize} " +
            "</script>")
    List<LocalRechargeRecord> listByCondition(@Param("parkingId") Integer parkingId,
                                              @Param("createdTime") String createdTime,
                                              @Param("plate") String plate,
                                              @Param("start") int start,
                                              @Param("pageSize") int pageSize);
}
